package com.cn.byjk.controller;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.stereotype.Controller;

/**
 * @author zhangdianzhi
 * @version v1.0
 * @description
 * @date 2022/1/08 10:56
 */
@Controller
@EnableBinding(Sink.class)
public class ReceiveMessagecontroller {
    @Value("${server.port}")
    private String serverPort;

    @StreamListener(Sink.INPUT)
    public void input(Message message){
        System.out.println("消费者一号-----收到的短信是："+message.getBody()+"\t 端口号是：" +serverPort);
    }
}
